import {UPDATE_USER_INFO,UPDATE_PAGE_LOADING_STATE,CLEAR_LOGIN_DATA,UPDATE_ROUTER_MENULIST} from './mutation_type'
import {getRouterMenuList} from "../../router/permission";

export default {
  [UPDATE_USER_INFO](state,data){
    if(data){
      state.userInfo=data
      localStorage.setItem('nick',data.nick)
      localStorage.setItem('token',data.token)
      localStorage.setItem('head',data.head)
    }
  },[UPDATE_PAGE_LOADING_STATE](state,loading){
    state.pageLoading=loading
  },[CLEAR_LOGIN_DATA](state){
    localStorage.clear()
    state.userInfo={}
  },[UPDATE_ROUTER_MENULIST](state,accessArr){
    state.routers=getRouterMenuList()
  }
};
